package com.zack.gcd;

/**
 * @author zack
 * @create 2019-08-02-14:00
 */
public class Gcd {
    //x>y
    //x和y的最大公约数等于y和x%y的最大公约数
    public int gcd(int x, int y) {
        if (y == 0) {
            return x;
        } else {
            return gcd(y, x % y);
        }
    }

    public static void main(String[] args) {
        Gcd gcd = new Gcd();
        System.out.println(gcd.gcd(20, 10));

    }
}
